//可索引的类型

interface dataDTO {
  [index: string]: {
    operation: number;
    selected: number;
  };
}

let datas: dataDTO = {
  key1: {
    operation: 1,
    selected: 1,
  },
  key2: {
    operation: 1,
    selected: 1,
  },
};

//定义对象
interface labelledObj {
  label: string;
}

let obj: labelledObj = {
  label: "123",
};

//可选属性

interface objPorps {
  name: string;
  address?: string;
}

let person: objPorps = {
  name: "test",
};

//只读属性

interface TestProps {
  readonly age: number;
}

let test: TestProps = {
  age: 18,
};
// test.age=16  无法分配到 "age" ，因为它是只读属性。

//类类型
//实现接口

//继承接口
//1.继承单个接口

interface Shape {
  color: string;
}

interface Square extends Shape {
  sidelenth: number;
}

let square: Square = {
  color: "11",
  sidelenth: 12,
};


//2.继承多个接口

interface PenStroke{
    width:number
}

interface BgColorProps extends Square,PenStroke{
    height:number
}

let bgColor:BgColorProps={
    height:100,
    sidelenth:100,
    width:100,
    color:'1'
}